package com.liangzhong.model.explore.vo
{
	import com.liangzhong.model.AppData;
	
	import flash.utils.ByteArray;

	/**
	 * 探索信息 
	 * @author Administrator
	 * 
	 */	
	public class ExploreInfoVo
	{
		public function ExploreInfoVo()
		{
		}
		
		/**
		 *球探等级 
		 */
		public var level:int;
		/**
		 *需要俱乐部等级 
		 */
		public var needlevel:int;
		/**
		 *升级球探所需欧元 
		 */
		public var coin:int;
		/**
		 *升级球探所需的声望 
		 */
		public var fame:int;
		/**
		 *球探上次升级时间 
		 */
		public var pretime:int;
		/**
		 *系统默认探索次数 
		 */
		public var explorecount:int;
		/**
		 *还剩下的探索次数 
		 */
		public var explorecoin:int;
		/**
		 *每次探索球员的数量 
		 */
		public var exploreplayer:int;
		/**
		 *上次探索时间 
		 */
		public var exploretime:int;
		
		/**
		 *冷却时间 秒 
		 */		
		public var freezingTime			:Number = 12 * 60 * 60;
		/**
		 *上次探索球星1 
		 */
		public var starid1:int;
		public var starid2:int;
		public var starid3:int;
		public var starid4:int;
		public var starid5:int;
		/**
		 *好感度 
		 */
		public var feel1:int;
		public var feel2:int;
		public var feel3:int;
		public var feel4:int;
		public var feel5:int;
		
		/**
		 *球星数据 
		 */
		public var starVoList:Array;
		
		/**
		 *解析数据 
		 * @param $obj
		 * 
		 */
		public function analysisData($obj:Object):void
		{
			for(var str:String in $obj)
			{
				if(this.hasOwnProperty(str))
				{
					this[str] = $obj[str];
				}
			}
			starVoList = [];
			var vo:FeelVo;
			vo = new FeelVo();
			vo.setStartVo(starid1,feel1,1);
			starVoList.push(vo);
			vo = new FeelVo();
			vo.setStartVo(starid2,feel2,2);
			starVoList.push(vo);
			vo = new FeelVo();
			vo.setStartVo(starid3,feel3,3);
			starVoList.push(vo);
			vo = new FeelVo();
			vo.setStartVo(starid4,feel4,4);
			starVoList.push(vo);
			vo = new FeelVo();
			vo.setStartVo(starid5,feel5,5);
			starVoList.push(vo);
//			exploretime = AppData.getInstance().time;
		}
		/**
		 *签约球星 
		 * @param $id
		 * 
		 */
		public function signStar($id:int):void
		{
			for each(var vo:FeelVo in starVoList)
			{
				if(vo.playerId == $id)
				{
					vo.playerId = 0;
					vo.feel = 0;
					vo.startVo = null;
					break;
				}
			}
		}
		/**
		 *改变好感度 
		 * @param $id
		 * @param $feel
		 * 
		 */
		public function changeFeel($id:int,$feel:int):void
		{
			for each(var vo:FeelVo in starVoList)
			{
				if(vo.playerId == $id)
				{
					vo.feel = $feel;
					break;
				}
			}
		}
		
		/**
		 *探索球员 返回数据
		 * 
		 */
		public function explorePlayer(buffer:ByteArray):void
		{
			explorecoin = buffer.readInt();
			starVoList.splice(0,starVoList.length);
			
			var vo:FeelVo;
			vo = new FeelVo();
			vo.setStartVo(buffer.readInt(),buffer.readByte(),1);
			starVoList.push(vo);
			vo = new FeelVo();
			vo.setStartVo(buffer.readInt(),buffer.readByte(),2);
			starVoList.push(vo);
			vo = new FeelVo();
			vo.setStartVo(buffer.readInt(),buffer.readByte(),3);
			starVoList.push(vo);
			vo = new FeelVo();
			vo.setStartVo(buffer.readInt(),buffer.readByte(),4);
			starVoList.push(vo);
			vo = new FeelVo();
			vo.setStartVo(buffer.readInt(),buffer.readByte(),5);
			starVoList.push(vo);
		}
	}
}